//应用feof判断文件是否结束
#pragma warning(disable:4996)
#include<stdio.h>
int main() 
{
	char ch;
	const char* arr = "abcdefg";
	FILE* fp = fopen("text.txt", "w+");
	if (!fp)	{
		perror("fp");
		return -1;
	}
	fputs(arr, fp);
	rewind(fp);
	while ((ch = fgetc(fp)) != EOF)
		printf("%c", ch);
	printf("\n");
	if (feof(fp))
		printf("read end!\n");
	else
		printf("read error!\n");
	return 0;
}